package animator.phantom.controller;

/*
    Copyright Janne Liljeblad 2006,2007,2008

    This file is part of Phantom2D.

    Phantom2D is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Phantom2D is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Phantom2D.  If not, see <http://www.gnu.org/licenses/>.
*/

import animator.phantom.renderer.IOPLibrary;
import animator.phantom.renderer.imagefilter.*;
import animator.phantom.renderer.imagesource.*;
import animator.phantom.renderer.imagemerge.*;
import animator.phantom.renderer.plugin.*;
import animator.phantom.renderer.coordtransformer.*;
import animator.phantom.renderer.threedee.*;
import animator.phantom.gui.GUIResources;

public class IOPLibraryInitializer
{

	public static void init()
	{
		System.out.print("INITIALIZING IOPS LIBRARY..." );

		//--- This method may be called many times.
		IOPLibrary.clear();

		//--- Create groups.
		IOPLibrary.registerGroup( "Color" );
		IOPLibrary.registerGroup( "Noise" );
		IOPLibrary.registerGroup( "Blur" );
		IOPLibrary.registerGroup( "Sharpen" );
		IOPLibrary.registerGroup( "Artistic" );
		IOPLibrary.registerGroup( "Source" );
		IOPLibrary.registerGroup( "Render" );
		IOPLibrary.registerGroup( "Merge" );
		IOPLibrary.registerGroup( "Key" );
		IOPLibrary.registerGroup( "Alpha" );
		IOPLibrary.registerGroup( "Mask" );
		IOPLibrary.registerGroup( "Distort" );
		IOPLibrary.registerGroup( "Animation" );
		IOPLibrary.registerGroup( "3D" );
		IOPLibrary.registerGroup( "LightEffects" );

		//--- File sources.
		IOPLibrary.registerIOP( new FileImageSource(), null );
		IOPLibrary.registerIOP( new MovieSourceIOP(), null );
		IOPLibrary.registerIOP( new SVGImageSource(), null );
		IOPLibrary.registerIOP( new ImageSequenceIOP(), null );

		//--- Color
		IOPLibrary.registerPlugin( new InvertPlugin(), "Color" );
		IOPLibrary.registerPlugin( new DesaturatePlugin(), "Color" );
		IOPLibrary.registerPlugin( new ThresholdPlugin(), "Color" );
		IOPLibrary.registerPlugin( new ContrastBrightnessPlugin(), "Color" );
		IOPLibrary.registerPlugin( new HueSatBrightPlugin(), "Color" );
		IOPLibrary.registerPlugin( new LevelsPlugin(), "Color" );
		IOPLibrary.registerPlugin( new QuantizePlugin(), "Color" );
		IOPLibrary.registerPlugin( new GreyscalePlugin(), "Color" );
		IOPLibrary.registerPlugin( new PosterizePlugin(), "Color" );
		IOPLibrary.registerPlugin( new SolarizePlugin(), "Color" );
		IOPLibrary.registerPlugin( new TritonePlugin(), "Color" );
		IOPLibrary.registerPlugin( new TwotonePlugin(), "Color" );
		IOPLibrary.registerIOP( new CurvesIOP(), "Color" );
		IOPLibrary.registerIOP( new ColorCorrectorIOP(), "Color" );
		IOPLibrary.registerPlugin( new ColorizePlugin(), "Color" );
		IOPLibrary.registerPlugin( new MaxRGBPlugin(), "Color" );
		//IOPLibrary.registerPlugin( new SmoothThresholdPlugin(), "Color" );

		//--- Noise
		IOPLibrary.registerPlugin( new DespecklePlugin(), "Noise" );
		IOPLibrary.registerPlugin( new DitherPlugin(), "Noise" );
		IOPLibrary.registerPlugin( new ScatterRGBPlugin(), "Noise" );
		IOPLibrary.registerPlugin( new SpreadPlugin(), "Noise" );
		IOPLibrary.registerPlugin( new HighPassPlugin(), "Noise" );

		//--- Sharpen
		IOPLibrary.registerPlugin( new SharpenPlugin(), "Sharpen" );
		IOPLibrary.registerPlugin( new UnsharpPlugin(), "Sharpen" );

		//--- Blur
		IOPLibrary.registerPlugin( new BoxBlurPlugin(), "Blur" );
		IOPLibrary.registerPlugin( new GaussianBlurPlugin(), "Blur" );
		IOPLibrary.registerPlugin( new LensBlurPlugin(), "Blur" );
		IOPLibrary.registerPlugin( new MotionBlurPlugin(), "Blur" );
		IOPLibrary.registerPlugin( new PixelizePlugin(), "Blur" );

		//--- Artistic
		IOPLibrary.registerPlugin( new EmbossPlugin(), "Artistic" ); 
		IOPLibrary.registerPlugin( new EdgesPlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new CrystallizePlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new ChromePlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new StampPlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new MarblePlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new PointillizePlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new QuickSketchPlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new PredatorPlugin(), "Artistic" );
		//IOPLibrary.registerPlugin( new AlienNeonPlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new SmearPlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new ColorHalfTonePlugin(), "Artistic" );
		IOPLibrary.registerPlugin( new HalfTonePlugin(), "Artistic" );

		//--- Source
		IOPLibrary.registerPlugin( new ColorSolidPlugin(), "Source" );
		IOPLibrary.registerPlugin( new GradientPlugin(), "Source" );
		IOPLibrary.registerPlugin( new CanvasPlugin(), "Source" );
		IOPLibrary.registerPlugin( new PolyLineShapePlugin(), "Source" );
		IOPLibrary.registerPlugin( new PolyCurveShapePlugin(), "Source" );
		IOPLibrary.registerPlugin( new ShapePlugin(), "Source" );
		IOPLibrary.registerPlugin( new ShapeGridPlugin(), "Source" );
		IOPLibrary.registerPlugin( new StripesPlugin(), "Source" );
		IOPLibrary.registerPlugin( new AnimatedColorSolidPlugin(), "Source" );
		IOPLibrary.registerPlugin( new PatternGradientPlugin(), "Source" );

		//--- Rendered Source
		IOPLibrary.registerPlugin( new CausticsPlugin(), "Render" );
		IOPLibrary.registerPlugin( new FourColorPlugin(), "Render" );
		IOPLibrary.registerPlugin( new PlasmaPlugin(), "Render" );
		IOPLibrary.registerPlugin( new BrushedMetalPlugin(), "Render" );
		IOPLibrary.registerPlugin( new SparklePlugin(),  "Render" );
		IOPLibrary.registerPlugin( new CheckerboardPlugin(),  "Render" );
		IOPLibrary.registerPlugin( new SolidNoisePlugin(),  "Render" );
		IOPLibrary.registerPlugin( new WoodPlugin(),  "Render" );
		IOPLibrary.registerPlugin( new ScratchPlugin(), "Render" );
		IOPLibrary.registerPlugin( new FBMPlugin(), "Render" ); 

		//--- Merge
		IOPLibrary.registerIOP( new BasicTwoMergeIOP(), "Merge" );
		IOPLibrary.registerPlugin( new ShapeMergePlugin(), "Merge" );
		IOPLibrary.registerPlugin( new ShapeGridMergePlugin(), "Merge" );
		IOPLibrary.registerPlugin( new SplitScreenPlugin(), "Merge" );

		IOPLibrary.registerNonUserPlugin( new FileImagePatternMergePlugin() );

		//--- Key 
		IOPLibrary.registerPlugin( new LumaKeyPlugin(), "Key" );
		IOPLibrary.registerPlugin( new MatteModifyPlugin(), "Key" );
		IOPLibrary.registerPlugin( new GreenKeyPlugin(), "Key" );
		IOPLibrary.registerPlugin( new ColorDifferenceKeyPlugin(), "Key" );
		IOPLibrary.registerPlugin( new ColorSampleKeyPlugin(), "Key" );
		IOPLibrary.registerPlugin( new SpillSuppressPlugin(), "Key" );

		//--- Alpha 
		IOPLibrary.registerPlugin( new ImageToAlphaPlugin(), "Alpha" );
		IOPLibrary.registerPlugin( new AlphaToImagePlugin(), "Alpha" );
		IOPLibrary.registerPlugin( new DivideByAlphaPlugin(), "Alpha" );
		IOPLibrary.registerPlugin( new AlphaReplacePlugin(), "Alpha" );
		IOPLibrary.registerPlugin( new AlphaMergePlugin(), "Alpha" );
		//IOPLibrary.registerPlugin( new AlphaFilterPlugin(), "Alpha" );
		IOPLibrary.registerPlugin( new ImageToAlphaMergePlugin(), "Alpha" );

		//--- Mask
		IOPLibrary.registerPlugin( new PolyLineMaskPlugin(), "Mask" );
		IOPLibrary.registerPlugin( new PolyCurveMaskPlugin(), "Mask" );
		IOPLibrary.registerPlugin( new GradientMaskPlugin(), "Mask" );
		IOPLibrary.registerPlugin( new ShapeMaskPlugin(), "Mask" );
		IOPLibrary.registerPlugin( new MaskJoinPlugin(), "Mask" );

		//--- Distort
		IOPLibrary.registerPlugin( new BumpPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new FlipPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new PolarPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new TwirlPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new RipplePlugin(), "Distort" );
		IOPLibrary.registerPlugin( new KaleidoscopePlugin(),"Distort" );
		IOPLibrary.registerPlugin( new PinchPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new SwimPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new SpherePlugin(), "Distort" );
		IOPLibrary.registerPlugin( new ShearPlugin(), "Distort" );
		IOPLibrary.registerPlugin( new PerspectivePlugin(), "Distort" );

		//--- Animation
		IOPLibrary.registerIOP( new NullIOP(), "Animation" );

		//--- 3D
		IOPLibrary.registerNonUserPlugin( new FileSource3DPlugin() );
		IOPLibrary.registerPlugin( new GeomObject3DPlugin(), "3D" );
		IOPLibrary.registerIOP( new Phantom3DCamera(), "3D" );
		IOPLibrary.registerPlugin( new Flow3DLayerPlugin(), "3D" );

		//--- LightEffects
		IOPLibrary.registerPlugin( new LightRaysPlugin(), "LightEffects" );

		System.out.println("DONE, " + IOPLibrary.getGroupKeys().size() + " groups and " + IOPLibrary.libSize() + " iops created." );
	}

}//end class